Skip to content

ARROW-14826 [R] Implement bindings for lubridate::dst()#12431

Closed
dragosmg wants to merge 7 commits into
apache:masterfrom
dragosmg:lubridate_dst
Closed

ARROW-14826 [R] Implement bindings for lubridate::dst()#12431
dragosmg wants to merge 7 commits into
apache:masterfrom
dragosmg:lubridate_dst

Conversation

@dragosmg

Copy link
Copy Markdown
Contributor

This PR adds support for lubridate::dst():

suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(arrow))

df <- tibble(
  dates = as.POSIXct(c("2021-02-20", "2021-07-31", "2021-10-31", "2021-01-31"), tz = "Europe/London")
)

df %>% 
  record_batch() %>% 
  mutate(is_dst = dst(dates)) %>% 
  collect()
#> # A tibble: 4 × 2
#>   dates               is_dst
#>   <dttm>              <lgl> 
#> 1 2021-02-20 00:00:00 FALSE 
#> 2 2021-07-31 00:00:00 TRUE  
#> 3 2021-10-31 00:00:00 TRUE  
#> 4 2021-01-31 00:00:00 FALSE

will be equivalent to:

suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))

df <- tibble(
  dates = as.POSIXct(c("2021-02-20", "2021-07-31", "2021-10-31", "2021-01-31"), tz = "Europe/London")
)

df %>% 
  mutate(is_dst = dst(dates))
#> # A tibble: 4 × 2
#>   dates               is_dst
#>   <dttm>              <lgl> 
#> 1 2021-02-20 00:00:00 FALSE 
#> 2 2021-07-31 00:00:00 TRUE  
#> 3 2021-10-31 00:00:00 TRUE  
#> 4 2021-01-31 00:00:00 FALSE

Created on 2022-02-15 by the reprex package (v2.0.1)

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

@dragosmg dragosmg marked this pull request as ready for review February 15, 2022 14:47
Comment thread r/tests/testthat/test-dplyr-funcs-datetime.R Outdated
@dragosmg dragosmg requested a review from jonkeane February 17, 2022 13:07
Comment thread r/tests/testthat/test-dplyr-funcs-datetime.R Outdated

@jonkeane jonkeane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very close, a few changes.

Comment thread r/tests/testthat/test-dplyr-funcs-datetime.R Outdated
Comment thread r/tests/testthat/test-dplyr-funcs-datetime.R Outdated
@dragosmg dragosmg requested a review from jonkeane February 22, 2022 16:32

@jonkeane jonkeane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good. Just need to rebase + then we can merge.

@dragosmg

Copy link
Copy Markdown
Contributor Author

Rebased

@jonkeane jonkeane closed this in 194ace5 Feb 23, 2022
@ursabot

ursabot commented Feb 23, 2022

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = 6aa3070 and contender = 194ace5. 194ace5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.42% ⬆️0.13%] test-mac-arm
[Failed ⬇️0.72% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.64% ⬆️0.0%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants